<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/activeqt/control/qaxbindable.cpp -->
<head>
  <title>Qt 4.3: QAxAggregated Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QAxAggregated Class Reference<br /><sup><sup>[<a href="qaxserver.html">QAxServer</a> module]</sup></sup></h1>
<p>The QAxAggregated class is an abstract base class for implementations of additional COM interfaces. <a href="#details">More...</a></p>
<pre> #include &lt;QAxAggregated&gt;</pre><ul>
<li><a href="qaxaggregated-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/>virtual long <b><a href="qaxaggregated.html#queryInterface">queryInterface</a></b> ( const QUuid &amp; <i>iid</i>, void ** <i>iface</i> ) = 0</li>
</ul>
<a name="protected-functions"></a>
<h3>Protected Functions</h3>
<ul>
<li><div class="fn"/>virtual <b><a href="qaxaggregated.html#dtor.QAxAggregated">~QAxAggregated</a></b> ()</li>
<li><div class="fn"/>IUnknown * <b><a href="qaxaggregated.html#controllingUnknown">controllingUnknown</a></b> () const</li>
<li><div class="fn"/>QObject * <b><a href="qaxaggregated.html#object">object</a></b> () const</li>
<li><div class="fn"/>QWidget * <b><a href="qaxaggregated.html#widget">widget</a></b> () const</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QAxAggregated class is an abstract base class for implementations of additional COM interfaces.</p>
<p>Create a subclass of QAxAggregated and reimplement <a href="qaxaggregated.html#queryInterface">queryInterface</a>() to support additional COM interfaces. Use multiple inheritance from those COM interfaces. Implement the IUnknown interface of those COM interfaces by delegating the calls to <tt>QueryInterface()</tt>, <tt>AddRef()</tt> and <tt>Release()</tt> to the interface provided by <a href="qaxaggregated.html#controllingUnknown">controllingUnknown</a>().</p>
<p>Use the <a href="qaxaggregated.html#widget">widget</a>() method if you need to make calls to the <a href="qwidget.html">QWidget</a> implementing the ActiveX control. You must not store that pointer in your subclass (unless you use <a href="qpointer.html">QPointer</a>), as the <a href="qwidget.html">QWidget</a> can be destroyed by the <a href="activeqt.html#activeqt">ActiveQt</a> framework at any time.</p>
<p>See also <a href="qaxbindable.html">QAxBindable</a>, <a href="qaxfactory.html">QAxFactory</a>, and <a href="activeqt.html">ActiveQt Framework</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="dtor.QAxAggregated"></a>QAxAggregated::~QAxAggregated ()&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>The destructor is called internally by Qt.</p>
<h3 class="fn"><a name="controllingUnknown"></a>IUnknown * QAxAggregated::controllingUnknown () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns the <tt>IUnknown</tt> interface of the ActiveX control. Implement the <tt>IUnknown</tt> interface in your <a href="qaxaggregated.html">QAxAggregated</a> subclass to delegate calls to <tt>QueryInterface()</tt>, <tt>AddRef()</tt>, and <tt>Release()</tt> to the interface provided by this function.</p>
<pre> HRESULT AxImpl::QueryInterface(REFIID iid, void **iface)
 {
     return controllingUnknown()-&gt;QueryInterface(iid, iface);
 }

 ulong AxImpl::AddRef()
 {
     return controllingUnknown()-&gt;AddRef();
 }

 ulong AxImpl::Release()
 {
     return controllingUnknown()-&gt;Release();
 }</pre>
<p>Instead of declaring and implementing these three functions manually, you can use the <tt>QAXAGG_IUNKNOWN</tt> macro in the class declaration of your subclass.</p>
<h3 class="fn"><a name="object"></a><a href="qobject.html">QObject</a> * QAxAggregated::object () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns a pointer to the <a href="qobject.html">QObject</a> subclass implementing the COM object. This function might return 0.</p>
<p><b>Warning:</b> You must not store the returned pointer, unless you use a <a href="qpointer.html">QPointer</a>, since the <a href="qobject.html">QObject</a> can be destroyed by <a href="activeqt.html#activeqt">ActiveQt</a> at any time.</p>
<h3 class="fn"><a name="queryInterface"></a>long QAxAggregated::queryInterface ( const <a href="quuid.html">QUuid</a> &amp; <i>iid</i>, void ** <i>iface</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Reimplement this pure virtual function to support additional COM interfaces. Set the value of <i>iface</i> to point to this object to support the interface <i>iid</i>. Note that you must cast the <tt>this</tt> pointer to the appropriate superclass.</p>
<pre> long AxImpl::queryInterface(const QUuid &amp;iid, void **iface)
 {
     *iface = 0;
     if (iid == IID_ISomeCOMInterface)
         *iface = (ISomeCOMInterface*)this;
     else
         return E_NOINTERFACE;

     AddRef();
     return S_OK;
 }</pre>
<p>Return the standard COM results <tt>S_OK</tt> (interface is supported) or <tt>E_NOINTERFACE</tt> (requested interface is not supported).</p>
<p><b>Warning:</b> Even though you must implement the <tt>IUnknown</tt> interface if you implement any COM interface you must not support the <tt>IUnknown</tt> interface in your queryInterface() implementation.</p>
<h3 class="fn"><a name="widget"></a><a href="qwidget.html">QWidget</a> * QAxAggregated::widget () const&nbsp;&nbsp;<tt> [protected]</tt></h3>
<p>Returns a pointer to the <a href="qwidget.html">QWidget</a> subclass implementing the ActiveX control. This function might return 0.</p>
<p><b>Warning:</b> You must not store the returned pointer, unless you use a <a href="qpointer.html">QPointer</a>, since the <a href="qwidget.html">QWidget</a> can be destroyed by <a href="activeqt.html#activeqt">ActiveQt</a> at any time.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
